import Fly from 'flyio/dist/npm/wx'

var fly = new Fly()
fly.config.baseURL = process.env.REQUEST_URI
// fly.config.baseURL = "https://api-pet.ctmon.com/"
// fly.config.headers = {
//   token: mpvue.getStorageSync("token"),
//   access_token: 11,
//   // 'Content-Type':'multipart/form-data; boundary=AaB03x'
//   'content-type': 'application/x-www-form-urlencoded'
// }

fly.interceptors.request.use((request) => {
  const token = mpvue.getStorageSync("token");
  if (token) {
    request.headers['token'] = token;
  } else {
    request.headers['token'] = mpvue.getStorageSync("user_token");
  }

  return request;
})

export default fly
